package com.franklin.java.action.sql.entity;

import com.franklin.java.api.state.BaseProjectPersistentState;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.components.StoragePathMacros;
import com.intellij.openapi.project.Project;

/**
 * @author Franklin
 * @since 2021/9/15 17:52
 */
@State(name = "com.franklin.java.action.sql.entity.EntityPathState",
    storages = {@Storage(StoragePathMacros.WORKSPACE_FILE)})
public class EntityPathState extends BaseProjectPersistentState<EntityPathState> {

    public String lastPath = myProject.getBasePath();

    public String lastPackage = "com.entity";

    public EntityPathState(Project myProject) {
        super(myProject);
    }

    public EntityPathState() {
    }

    public static EntityPathState getInstance(Project project){
        return project.getService(EntityPathState.class);
    }

    public static String getLastPath(Project project){
        return getInstance(project).lastPath;
    }

    public static String getLastPackage(Project project){
        return getInstance(project).lastPackage;
    }
}
